package com.example.psychologicalappointmentsystem.Entity;

import com.example.psychologicalappointmentsystem.Enum.OrderStatus;
import com.example.psychologicalappointmentsystem.Enum.PaymentStatus;
import com.example.psychologicalappointmentsystem.Enum.OrderType;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

@Entity
@Data
@Table(name = "consultation_order")
public class OrderDO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "consultant_id")
    private Long consultantId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "start_time")
    private Date startTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "end_time")
    private Date endTime;

    @Enumerated(EnumType.STRING)
    @Column(name = "status")
    private OrderStatus status;// '订单状态：0-待确认,1-已预约,2-已取消,3-已完成,4-已过期',

    @Column(name = "fee")
    private Long fee; // '咨询费用（单位：元）',

    @Enumerated(EnumType.STRING)
    @Column(name = "payment_status")
    private PaymentStatus paymentStatus; //'支付状态：0-未支付,1-已支付,2-退款中,3-已退款',
    @Column(name = "payment_method")
    private String paymentMethod; //'支付方式（如：微信、支付宝、银行卡）',
    @Column(name = "transaction_id")
    private String transactionId; //'第三方支付平台交易号'

    @Temporal(TemporalType.TIMESTAMP)
    @CreationTimestamp
    @Column(name = "created_date")
    private Date createdDate;//'订单创建时间',

    @Temporal(TemporalType.TIMESTAMP)
    @UpdateTimestamp
    @Column(name = "updated_date")
    private Date updatedDate;// '最后更新时间',
    @Column(name = "remark")
    private String remark; // '用户备注（如特殊需求）',

    @Enumerated(EnumType.STRING)
    @Column(name = "order_type")
    private OrderType orderType; // '',

    @Column(name = "canceled_msg")
    private String canceledMsg;//取消理由
}
